<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellpadding="9" cellspacing="0" bordercolor="#000" style="width: 100%">
          <tr>
            <th colspan="9">
              <div style="position: relative;text-align: center">
                <img src="@/assets/reportIcon.png" width="100px" height="30px" style="position: absolute;left: 0px;top:-5px"/>
                <span>{{ (lineType === 'SMT' ? 'SMT' :  '' ) + title[type]}}</span>
              </div>
            </th>
          </tr>
          <tr style="width: 100%" align="center">
            <th>序号</th>
            <th>日期</th>
            <th>机型</th>
            <th>站别</th>
            <th>检测项目</th>
            <th>{{ type === '1' ? '抽测数量' : '抽检数量'  }}</th>
            <th>{{ type === '1' ? '抽测时间' : '抽检时间'  }}</th>
            <th>{{ type === '1' ? '抽测结果' : '抽检结果'  }}</th>
<!--            <th>{{ type === '1' ? '测试人' : '测试人'  }}</th>-->
            <th>QC确认人</th>
          </tr>
          <tr v-for="(item,index) in reportData">
            <td>{{index+1}}</td>
            <td>{{item.createTime}}</td>
            <td>{{item.mecType}}</td>
            <td>{{item.staType}}</td>
            <td>{{item.checkPro}}</td>
            <td>{{item.checkNum}}</td>
            <td>{{item.inDate}}</td>
            <td>{{item.result}}</td>
<!--            <td>{{item.createBy}}</td>-->
            <td>{{item.createBy}}</td>
          </tr>
          <tr>
            <th colspan="9">注解：<br>
              <span>1.每两小时抽测一次</span><br>
              <span>2.发现异常，立即确认是否批量不良，并按异常反馈流程执行。</span><br>
            </th>
          </tr>
          <tr>
            <th colspan="9">
              <span>
                文件编号:{{ number }}<br/>
                保存期限:1年<br/>
                版本:1.0<br/>
                主管确认:
              </span>
            </th>
          </tr>
        </table>
        <div v-if="type === '2' && lineType === 'SMT'" style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-113</div>
          <div>保存期限:1年</div>
          <div>版本:1.0</div>
        </div>
        <div v-if="type === '1' && lineType === 'SMT'" style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-089</div>
          <div>保存期限:2年</div>
          <div>版本:1.0</div>
        </div>
        <div v-if="type === '2' && lineType === 'DIP'" style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-112</div>
          <div>保存期限:1年</div>
          <div>版本:1.0</div>
        </div>
        <div v-if="type === '1' && lineType === 'DIP'" style="display: flex;justify-content: space-between">
          <div>文件编号:YZY-QRQC-111</div>
          <div>保存期限:1年</div>
          <div>版本:1.0</div>
        </div>

      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** 抽测表 **/
  name: 'SpotCheck',
  props:{
    reportData:{
      type:Array,
      default:()=>{[]}
    },
    type:{
      type:String,
      default:''
    },
    lineType:{
      type:String,
      default:''
    },
  },
  mounted() {
    if(this.lineType === 'SMT' &&  this.type === '1'){
      this.number = 'YZY-QRQC-111'
    }else if(this.lineType === 'SMT' &&  this.type === '2'){
      this.number = 'YZY-QRQC-112'
    }else{
      this.number = 'YZY-QRQC-113'
    }
  },
  data(){
    return {
      title:{
        '1':'抽测记录表',
        '2':'抽检记录表',
        '3':'抽检记录表'
      },
    }
  }
}
</script>

<style scoped>

</style>